Replace Base.convert(::Type{SparseArrays.SparseMatrixCSC}, J::SUNMat… #316
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Replace Base.convert(::Type{SparseArrays.SparseMatrixCSC}, J::SUNMatrix) with copyto!
Fix for #315
Proximate cause was that the SUNMatrix sparse Jacobian was not fully initialised,
hence failed the SparseMatrixCSC consistency checks introduces with
Julia 1.7
More fundamentally, given that Sundials uses zero-based index arrays,
convert(::Type{SparseArrays.SparseMatrixCSC}, J::SUNMatrix)
would either need to allocate, or is inherently unsafe as an in-place
version that applied a 1-based index conversion would create an
invalid SUNMatrix.
Also the convert code here looks like it modified colptr but
not rowptr, so couldn't have worked anyway... (cvodejac and similar
used to overwrite this, which is why those calls worked).